from django.urls import path, include
from rest_framework_simplejwt.views import TokenRefreshView
from system.user.views.user import user_info, test_api
from system.user.views.login import LoginView

# from utils.resp import json_404

urlpatterns = [
    path('account/login', LoginView.as_view(), name='token_obtain_pair'),
    path('account/getLoginUser', user_info),
    path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    # re_path('role/role_id_to_menu/(?P<pk>.*?)/', RoleViewSet.as_view({'get': 'roleId_to_menu'})),
    path('system/menu/', include('system.menu.urls')),
    path('system/home/', include('system.home.urls')),
    path('system/user/', include('system.user.urls')),
    path('system/role/', include('system.role.urls')),
    path('system/op_log/', include('system.oplog.urls')),
    path('system/host/', include('system.host.urls')),
    path('system/file/', include('system.file.urls')),
    path('system/settings/', include('system.settings.urls')),
    path('system/project/', include('system.project.urls')),
    path('system/script/', include('main.script.urls')),
    path('system/alarm/', include('main.alarm.urls')),
    path('system/task/', include('main.task.urls')),
    path('system/test', test_api),
    # path('main/project/', include('main.demo.urls')),
]

# django 404 页面返回json处理，目前还没找到比此方法更加优雅的方式处理404
# handler404 = json_404
